<?php
defined('_JEXEC') or die;

jimport('joomla.application.component.modellist');

/**
 * Webide option model.
 *
 * @package     Joomla.Administrator
 * @subpackage  com_webide
 * @since       2.5
 */

class WebideModelOptions extends JModelList {
	// Update filter states
	//protected $order_column = '';
	//protected $order_direction = '';
	public function populateState() {
		$filter_order = JRequest::getCmd('filter_order', 'name');
		$filter_order_Dir = JRequest::getCmd('filter_order_Dir', 'asc');
		$this->setState('filter_order', $filter_order);
		$this->setState('filter_order_Dir', $filter_order_Dir);
	}
	// Function used by getItems & getPagination
	protected function getListQuery() {
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		$query->select('id,name,value,description');
		$query->from('#__webide_options');
		$column = $this->getState('filter_order', 'name');
		//$this->escaped();
		$dir = $this->getState('filter_order_Dir', 'ASC');
		//dumpMessage($column.'-'.$ord);				
		$query->order( $column . ' ' . $dir);
dumpMessage($query->dump(), 'q');
		//dumpMessage($this->getState('list.ordering'),'ordering');		
		return $query;
	}
}
